#!/bin/sh
########################################################################
# Begin unbound
#
# Description : Unbound DNS resolver boot script
#
# Author      : Igor Živković <contact@igor-zivkovic.from.hr>
#
# Version     : BLFS 8.0
#
########################################################################


### BEGIN INIT INFO
# Provides:          unbound
# Required-Start:    $network
# Should-Start:      networkmanager wicd
# Required-Stop:     $network
# Should-Stop:       networkmanager wicd
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: Starts Unbound DNS resolver
# X-LFS-Provided-By: BLFS
### END INIT INFO

. /lib/lsb/init-functions

#$LastChangedBy: dj $
#$Date: 2019-09-08 13:50:13 -0500 (Sun, 08 Sep 2019) $

case "$1" in
   start)
      log_info_msg "Starting Unbound DNS resolver..."
      unbound-anchor
      start_daemon /usr/sbin/unbound
      evaluate_retval
      ;;

   stop)
      log_info_msg "Stopping Unbound DNS resolver..."
      killproc -p "/run/unbound.pid" /usr/sbin/unbound
      evaluate_retval
      ;;

   restart)
      $0 stop
      sleep 1
      $0 start
      ;;

   status)
      statusproc /usr/sbin/unbound
      ;;

   *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1
      ;;
esac

# End unbound
